<?php declare(strict_types=1);

namespace think\msg\platform\feishu\dto;

use think\msg\platform\feishu\RequestDto;

class RichTextMsgDto extends RequestDto
{
    protected $msg_type = 'post';

    protected $content = [
        'post' => [
            'zh_cn' => [
                'title' => null,
                'content' => [
                    [
                        'tag' => 'text',
                        'text' => null,
                    ],
                    [
                        'tag' => 'at',
                        'user_id' => null,
                    ],
                    [
                        'tag' => 'img',
                        'img_key' => null,
                    ],
                    [
                        'tag' => 'a',
                        'text' => null,
                        'href' => null,
                    ],
                ],
            ],
        ],
    ];

    public function setTitle(string $title): void
    {
        $this->content['post']['zh_cn']['title'] = $title;
    }

    public function setContent(array $content): void
    {
        $this->content['post']['zh_cn']['content'] = $content;
    }
}
